﻿using System;

namespace VisualWip.Core
{
    public sealed class WorkInProgressLimitCalculator
    {
        private WorkInProgressLimitCalculator()
        {
        }

        public static Tuple<int, int> DualQueries(int wipl, int firstColumnWorkCount, int secondColumnWorkCount)
        {
            if (secondColumnWorkCount == 0)
            {
                return new Tuple<int, int>(wipl, 1);
            }

            if (secondColumnWorkCount >= wipl)
            {
                return new Tuple<int, int>(0, wipl);
            }

            int s = Math.Min(wipl, secondColumnWorkCount + 1);

            if (firstColumnWorkCount >= wipl)
            {
                return new Tuple<int, int>(wipl - secondColumnWorkCount, s);
            }


            int min = Math.Min(wipl, wipl - secondColumnWorkCount);
            return new Tuple<int, int>(min, s);
        }
    }
}